<!DOCTYPE html>
<html>
<head>
    <title>安全库存</title>
    #parse("sys/header.html")
    <style>
        .sugon_upload_btn {
            display: -webkit-inline-box;
            display: inline-block;
        }

        ::-webkit-scrollbar {
            width: 10px;
            height: 10px;
        }

        ::-webkit-scrollbar-thumb {
            border-radius: 10px;
            -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
            background: #a8a5a5;
        }
    </style>
</head>
<body>
<div id="rrapp" v-cloak>
    <div v-show="showList">
        <Row :gutter="16" style="margin: 8px 0px 0px 1px">
            <div class="search-group">
                <i-col span="3">
                    <i-input v-model="q.partName" @on-enter="query" placeholder="备件名称"></i-input>
                </i-col>
                <i-col span="3">
                    <i-input v-model="q.spec" @on-enter="query" placeholder="备件规格"></i-input>
                </i-col>
                <i-col span="3">
                    <i-input v-model="q.erpCode" @on-enter="query" placeholder="ERP编码"></i-input>
                </i-col>
                <i-col span="2">
                    <i-input v-model="q.producor" @on-enter="query" placeholder="生产厂家"></i-input>
                </i-col>
                <i-col span="2">
                    <i-select v-model="q.installPosition" placeholder="备件类型">
                        <i-option v-for="category in sparePartInstallPositionList" :value="category.id" :key="category.id">{{category.name}}</i-option>
                    </i-select>
                </i-col>
                <i-col span="2">
                    <i-select v-model="q.state" placeholder="审核状态">
                        <i-option value="">请选择</i-option>
                        <i-option v-for="status in statusList" :value="status.value" :key="status.value">
                            {{status.name}}
                        </i-option>
                    </i-select>
                </i-col>
                <i-col span="3">
                    <i-button @click="query">查询</i-button>
                    <i-button @click="reloadSearch">重置</i-button>
                </i-col>
            </div>
        </Row>
        <Row :gutter="16" style="margin: 3px 0px 0px 0px;">
            <div class="buttons-group">
                #if($shiro.hasPermission("sparepartsafestock:import"))
                <Upload ref="uploadFile"
                        action="../sparepartsafestock/import"
                        :format="['xlsx','xls']"
                        :before-upload="handleBeforeUploadExcel"
                        :on-success="handleImportExcelSuccess" :on-error="handleImportExcelError"
                        :on-format-error="handleExcelFormatError" class="sugon_upload_btn">
                    <i-button type="error"><i class="fa fa-hand-o-down"></i>&nbsp;导入</i-button>
                </Upload>
                #end
                #if($shiro.hasPermission("sparepartsafestock:export"))
                <i-button type="success" @click="exportData"><i class="fa fa-hand-o-up"></i>&nbsp;导出</i-button>
                #end
                #if($shiro.hasPermission("sparepartsafestock:commitApprove"))
                <i-button type="info" @click="commitCheck"><i class="fa fa-upload"></i>&nbsp;提交审核</i-button>
                #end
                #if($shiro.hasPermission("sparepartsafestock:check"))
                <i-button type="primary" @click="deptCheck"><i class="fa fa-gavel"></i>&nbsp;审核</i-button>
                #end
                #if($shiro.hasPermission("sparepartsafestock:save"))
                <i-button type="info" @click="add"><i class="fa fa-plus"></i>&nbsp;新增</i-button>
                #end
                #if($shiro.hasPermission("sparepartsafestock:update"))
                <i-button type="warning" @click="update"><i class="fa fa-pencil-square-o"></i>&nbsp;修改</i-button>
                #end
                #if($shiro.hasPermission("sparepartsafestock:delete"))
                <i-button type="error" @click="del"><i class="fa fa-trash-o"></i>&nbsp;删除</i-button>
                #end
            </div>
        </Row>
        <Row>
            <i-col span="3">
                <ul id="storeTree" class="ztree"></ul>
            </i-col>
            <i-col span="24">
                <table id="jqGrid"></table>
            </i-col>
        </Row>
    </div>

    <Card v-show="!showList">
        <p slot="title">{{title}}</p>
        <i-form ref="formValidate" :model="sparePartSafeStock" :rules="ruleValidate" :label-width="90">
            <Row>
                <i-col span="11">
                    <Form-item label="备件" prop="sparePartId">
                        <i-input v-model="sparePartsDesc" placeholder="请点击选择备件" @on-click="getSparePart" readonly
                                 icon="md-arrow-dropdown-circle"/>
                    </Form-item>
                </i-col>
            </Row>
            <Row>
                <i-col span="11">
                    <Form-item label="安全库存数" prop="safeNum">
                        <input-number v-model="sparePartSafeStock.safeNum" placeholder="请点输入安全库存数" :min="1"
                                      style="width: 100%"></input-number>
                    </Form-item>
                </i-col>
            </Row>
            <Row>
                <i-col span="11">
                    <Form-item label="备注" prop="remark">
                        <i-input type="textarea" v-model="sparePartSafeStock.remark" placeholder="备注"></i-input>
                    </Form-item>
                </i-col>
            </Row>
            <Form-item>
                <i-button type="primary" @click="handleSubmit('formValidate')">提交</i-button>
                <i-button type="warning" @click="reload" style="margin-left: 8px"/>
                返回</i-button>
                <i-button type="info" @click="handleReset('formValidate')" style="margin-left: 8px">重置</i-button>
            </Form-item>
        </i-form>
    </Card>
    <!-- 审核表单区域 -->
    <div id="reviewLayer" style="display: none;">
        <form class="form-horizontal" style="width: 500px;">
            <div class="form-group">
                <div class="form-group">
                    <div class="col-sm-2 control-label">审核状态</div>
                    <div class="col-sm-10" style="margin-top: 6px">
                        <Radio-group v-model="approveParam.status">
                            <Radio :label="1"><span>通过</span></Radio>
                            <Radio :label="2"><span>不通过</span></Radio>
                        </Radio-group>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-sm-2 control-label">备注</div>
                    <div class="col-sm-10" style="margin-top: 6px">
                        <i-input type="textarea" v-model="approveParam.remark" :rows="4" maxlength="255" show-word-limit
                                 placeholder="审批备注"></i-input>
                    </div>
                </div>
            </div>
        </form>
    </div>
    <!-- 审核列表区域 -->
    <div id="auditHistoryArea" style="display: none;padding: 5px">
        <i-table border :columns="auditTableColumns" :data="auditTableData"></i-table>
    </div>
    <!--  关键零部件查看  -->
    <div id="sparePartsKeyArea" style="display: none;padding: 5px">
        <i-table border :columns="keyTableColumns" :data="keyTableData"></i-table>
    </div>
</div>

<script src="${rc.contextPath}/js/spare/sparepartsafestock.js?_${date.systemTime}"></script>
</body>
</html>
